<p class="photo">
  <% if f.object.new_record? %>
    <%= f.file_field :photo %>
    <%= link_to_function "Удалить", "this.up('.photo').remove()" %>
  <% else %>
    <%= image_tag(f.object.photo.url(:thumb)) %>
    <%= remove_link_unless_new_record(f) %>
  <% end %>
</p>

